import { _decorator, Color, Component, find, Node, Sprite, tween, UIRenderer, UITransform, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('CardUI')
export default class CardUI extends Component {
    @property({ displayName: "上升高度" })
    rise_height_n = 20;

    private _selected_b: boolean = false;
    private _rise_b: boolean = false;

    /**获取选中状态 */
    get selected_b(): boolean { return this._selected_b; }

    /**设置选中状态 */
    set selected_b(v_b: boolean) {
        if (this._selected_b == v_b) { return; }
        this._selected_b = v_b;
        this.node.getComponent(Sprite).color = this._selected_b ? Color.GRAY : Color.WHITE;
    }
    
    /**获取上升状态 */
    get rise_b(): boolean { return this._rise_b; }
    
    /**设置上升状态 */
    set rise_b(v_b: boolean) {
        if (this._rise_b == v_b) { return; }
        this._rise_b = v_b;
        // this.node.y = this._rise_b ? this.rise_height_n : 0;
        // this.node.getComponent(UITransform).height = this._rise_b ? this.rise_height_n : 0;
        let y = this._rise_b ? this.rise_height_n : 0;
        this.node.setPosition(this.node.getPosition().x, y, this.node.getPosition().z)
    }

}


